/**
 * Created by Administrator on 15-10-10.
 */
window.onload=function() {
    var url = getUrl();
    var id=getUserId();
    var supplierId = $.getUrlParam("supplierId");
    $.jsonp({
        url: 'http://'+url+'/api/user/user_address_list',
        data: {userId:id},
        callbackParameter: "callback",
        success: function (data, textStatus, xOptions) {
            $.each(data.arrays, function (index, ele) {
                var sex = "female";
                if (ele.sex == 1)
                    sex = "male";
                var html = '<li class="ui-border-t w_curd">' +
                    '<label class="ui-checkbox-s">' +
                    '<input type="radio" data-id="'+ele.id+'" name="checkbox" checked>' +
                    '</label>' +
                    '<em style="padding-left: 12px;">'+ele.realName+'&nbsp&nbsp'+ele.telphone+'&nbsp&nbsp'+ele.areaCode+'<br/>'+ele.address+'</em>' +
                    '<a href="dizhitianxie.html?userAddressId='+ele.id+'">' +
                    '<img src="img/bianji.png"></a>'+
                    '</li>';
                $("#dizhi").append(html)
            });

            $(document).on('click','input:checked',function(){
                var dzId = $("input:checked").data('id');
                //console.log(dzId)
                window.location = "yiren_tijiaodingdan.html?supplierId="+supplierId+"&addrId="+dzId;

            });
        },

        error: function (xOptions, textStatus) {
        }
    });
}
